//
//  MyListViewModel.swift
//  studyRxSwiftDemo
//
//  Created by jemi on 2019/12/18.
//  Copyright © 2019 jemi. All rights reserved.
//

import RxSwift
import RxCocoa

struct MyListViewModel {
    
    let username = BehaviorRelay(value: "guest")
    lazy var userinfo = {
        return self.username.asObservable()
            .map { $0 == "hangge" ? "管理员" :"普通访客"}
            .share(replay: 1)
    }()
    
    let data = Observable.just([
        My(name: "lafite", age: 15, sex: "男"),
        My(name: "jiuge", age: 16, sex: "男"),
        My(name: "lisa", age: 17, sex: "女"),
        My(name: "joke", age: 18, sex: "男"),
    ])
    func te() {
        let p999 = PublishSubject<String>()
        p999.onNext("1223")
        p999.subscribe { (string) in
            
        }.disposed(by: DisposeBag())
    }
    let obs = Observable<Any>.create { (observer) -> Disposable in
        //
        print("测试 ======= ")
        observer.onNext("网络请求完成了")
        return Disposables.create()
    }
}

